package com.webreport.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webreport.dao.ReportDao;
import com.webreport.exception.DaoException;
import com.webreport.exception.ManagerException;
import com.webreport.model.ReportModel;
import com.webreport.model.db.Report;
import com.webreport.service.ReportManager;

@Service("reportManager")
public class ReportManagerImpl extends GenericManagerImpl<Report, String> implements ReportManager {
	ReportDao dao;
	
	@Autowired
	public ReportManagerImpl(ReportDao dao) {
		super(dao);
		this.dao = dao;
	}
	
	public List<ReportModel> queryList(ReportModel queryparams,int startrow,int size) throws ManagerException{
		List<ReportModel> reports;
		try {
			reports = dao.queryList(queryparams, startrow, size);
		} catch (DaoException e) {
			log.error(e.getMessage());
			throw new ManagerException(e.getMessage());
		}
		return reports;
	}
	public long queryListCount(ReportModel queryparams) throws ManagerException{
		long rows = 0;
		try {
			rows =  dao.queryListCount(queryparams);
		} catch (DaoException e) {
			log.error(e.getMessage());
			throw new ManagerException(e.getMessage());
		}
		return rows;
	}
}
